<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');
?>

<h1>Edit Instructor</h1>

<?php

$instructor_id = mysql_real_escape_string(strip_tags($_POST['id']));
$instructor_fname = mysql_real_escape_string(strip_tags($_POST['fname']));
$instructor_lname = mysql_real_escape_string(strip_tags($_POST['lname']));

//initialize variables used to connect to database
$db = "scheduler";
$user = "root";
$pass = "";

//connect to database
mysql_connect("localhost", $user, $pass);
@mysql_select_db($db);

//select statement
$query="UPDATE instructors 
SET first_name='$instructor_fname', last_name='$instructor_lname'
WHERE id='$instructor_id'";

$result=mysql_query($query);

//close
mysql_close();

if ($result)
{
	echo "<b>".stripslashes($instructor_fname)." ".stripslashes($instructor_lname)."</b> has been successfully updated!";
	echo "<br />";
}
else
{
	echo "<b>".stripslashes($instructor_fname)." ".stripslashes($instructor_lname)."</b> was NOT able to be updated at this time!";
	echo "<br />";
}


?>

<p>
	<a href="index.php">Instructors Portal</a><br />
</p>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>